import React, { Component } from 'react'
import { connect } from 'react-redux'

// 装饰器，它到目前还是只是一个草案，react不支持，包括js本身也不支持，需要babel兼容

@connect(state => state, {
  addNum(n) {
    return { type: 'add', payload: n }
  }
})
class App extends Component {
  incr = () => {
    this.props.addNum(10)
  }
  render() {
    // console.log(this.props)
    return (
      <div>
        <h3>{this.props.num}</h3>
        <button onClick={this.incr}>++++</button>
      </div>
    )
  }
}

// export default connect(state => state, null)(App)
export default App
